<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="http://localhost/YouHuoShop/Static/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="http://localhost/YouHuoShop/Static/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="http://localhost/YouHuoShop/Static/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="http://localhost/YouHuoShop/Static/Admin/Flat/img/favicon.ico">
    	<script type="text/javascript" src="http://localhost/YouHuoShop/Static/uploadify/jquery-1.8.2.min.js"></script>
    	<script type="text/javascript">
    		ajaxUrl="<?php echo U('ajaxUnique',array('gid'=>$_GET['gid']));?>"
    	</script>
    	<script src="http://localhost/YouHuoShop/Static/Admin/js/goodsList.js" type="text/javascript" charset="utf-8"></script>
	    <style type="text/css">
	    	.table tr{
	    		height:40px;
	    	}
	    	.table tr td{
	    		line-height: 40px;
	    	}
	    	.table .add th{
	    		line-height: 40px;
	    	}
	    	.all{
	    		width:100%;height:800px;background: #000;opacity: 0.4;
	    		border:1px solid transparent;
	    		position:fixed;
	    		top:0px;
	    		left:0px;
	    		display: none;
	    	}
	    	.box{
	    		background: white;
	    		position:fixed;
	    		top:150px;
	    		left:0px;
	    		z-index: 10;
	    		display: none;
	    	}
	    </style>
	</head>
	<body>
		<table class="table table-hover">
			<tr class="active">
			  <th width="120">货品ID</th>
			  <!--循环出该商品选择的规格-->
			  <?php foreach ($attr as $k=>$v){?>
				  <th><?php echo $v['0']['tp_aname'];?></th>
			  <?php }?>
			  <th width="180">库存</th>
			  <th width="180">货号</th>
			  <th width="210">操作</th>
			</tr>
			<!--货品列表区 循环-->
			<?php foreach ($listData as $k=>$l){?>
				<tr>
					<td class="glidNum"><?php echo $l['glid'];?></td>
					<?php foreach ($l['combine'] as $kk=>$vv){?>
						<td><?php echo $vv;?></td>
					<?php }?>
					<td><?php echo $l['inventory'];?></td>
					<td><?php echo $l['number'];?></td>
					<td>
						<a href="javascript:;" class="btn btn-sm btn-warning edit">修改</a>
						<!--<a href="<?php echo U('editGoodsList',array('glid'=>$l['glid']));?>" class="btn btn-sm btn-warning edit">修改</a>-->
						<a href="<?php echo U('del',array('glid'=>$l['glid'],'inventory'=>$l['inventory'],'gid'=>$_GET['gid']));?>" class="btn btn-sm btn-danger">删除</a>
					</td>
				</tr>
			<?php }?>
			<!--货品列表区结束-->
			<!--添加货品区域开始-->
			<tr class="active add">
				<form action="" method="post">
					<th>添加货品</th>
					<?php foreach ($attr as $k=>$v){?>
						<td>
							<select name="combine[]" class="form-control" >
								<option value="0">请选择</option>
								<?php foreach ($v as $kk=>$vv){?>
									<option value="<?php echo $vv['gaid'];?>"><?php echo $vv['attr_value'];?></option>
								<?php }?>
							</select>
						</td>
				 	<?php }?>
				 	<td>
						<input type="text" class="form-control" name="inventory" required="" value="" />
					</td>
					<td>
						<input type="text" class="form-control"	 name="number" value="" />
					</td>
					<td>
						<input type="reset" value="" id="res" style="display: none;" />
						<input style="width:105px;" type="submit" class="btn btn-primary" value="添 加 货 品"/>
					</td>
				</form>
			</tr>
			<!--添加货品区域结束-->
		</table>
		<div class="all">
		</div>	
		
		<table class="box table ">
			<!--编辑区域开始-->
			<tr class="active editList">
				<form action="<?php echo U('editGoodsList');?>" method="post">
					<th width="120" style="line-height: 40px;" class="td">修改货品</th>
					<?php foreach ($attr as $k=>$v){?>
						<td class="td">
							<select name="combine[]" class="form-control" >
								<option value="0">请选择</option>
								<?php foreach ($v as $kk=>$vv){?>
									<option value="<?php echo $vv['gaid'];?>"><?php echo $vv['attr_value'];?></option>
								<?php }?>
							</select>
						</td>
				 	<?php }?>
				 	<td width="180" class="td">
						<input type="text" class="form-control" name="inventory" value=""/>
					</td>
					<td width="180" class="td">
						<input type="text" class="form-control"	 name="number" value=""/>
					</td>
					<td width="210" class="td">
						<input type="hidden" name="oldInventory" id="oldInventory" value="" />
						<input type="hidden" name="glid" value="" id="glid"/>
						<input type="hidden" name="goodsGid" id="goodsGid" value="<?php echo $hd['get']['gid'];?>" />
						<input style="width:105px;" type="submit" class="btn btn-sm btn-warning" value="确定"/>
						<a href="javascript:;" class="btn btn-sm btn-primary cancle">取消</a>
					</td>
				</form>
			</tr>
			<!--编辑区域结束-->
		</table>
	</body>
</html>


























